/* 险段信息 弹框
* @ 劳兆城 
* @ 2017-08-12*/

<template>
	<interact-model 
		ref="interact-model"
		title="险段信息"
		class="criticals-model">
		<div class="criticals-warpper">
			<div class="criticals-table">
				<table border class="table">
					<tbody>
						<tr>
							<td>线段名称</td>
							<td>{{fliterData('danger_name')}}</td>
							<td>所属堤围</td>
							<td>{{fliterData('dick_name')}}</td>
						</tr>
						<tr>
							<td>所在镇(街)</td>
							<td>{{fliterData('town')}}</td>
							<td>桩号(公里+米)</td>
							<td>{{fliterData('stake_no')}}</td>
						</tr>
						<tr>
							<td>线段长度</td>
							<td>{{fliterData('danger_length')}}</td>
							<td>最大冲深底高程(米)</td>
							<td>{{fliterData('max_depth')}}</td>
						</tr>
						<tr>
							<td>线段形态</td>
							<td>{{fliterData('danger_type')}}</td>
							<td>最近整治年份</td>
							<td>{{fliterData('renovate_year')}}</td>
						</tr>
						<tr>
							<td>经纬度</td>
							<td>{{fliterData('lat')}}</td>
							<td>备注</td>
							<td>{{fliterData('NOTE')}}</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
		<loading v-show="showLoading"></loading>
	</interact-model>
</template>

<script>
	import {
		loadingMixin,
		interactModelMixin,
		aPictureModelMixin
	} from 'common/js/mixins'
import { ERR_OK } from 'api/config'
 	import { getCriticalsInfo } from 'api/aPicture'

export default {
		mixins: [
			loadingMixin,
			interactModelMixin,
			aPictureModelMixin
		],
		data () {
			return {
				showLoading: false
			}
		},
		methods: {
			show (feature) {
				this.$refs['interact-model'].showModel()
			this._getInfo(feature.get('name'))
		},
			_getInfo (name) {
				this.showLoading = true
			getCriticalsInfo(name).then(res => {
					if (res.code === ERR_OK) {
						this.data = res.result[0] || {}
				}
					this.showLoading = false
			})
			}
		}
	}
</script>

<style lang="scss">
	.criticals-model {
		width: 500px;
		height: 300px;
		.criticals-warpper {
			width: 100%;
			height: 100%;
			position: relative;
			padding: 5px;
			.criticals-table {
				width: 100%;
				height: 100%;
				.table {
					width: 100%;
					font-size: 14px;
					border: 1px solid #ddd;
					td {
						width: 25%;
						padding: 5px;
					}
				}
			}
		}
	}
</style>